<template>
  <el-pagination  
    background layout="prev, pager, next" 
    :total="pagination.total" 
    :page-size.sync="pagination.pageSize" 
    @current-change="handleNumChange"
    v-if="reload"
  />
</template>

<script>

export default {
  name: '',
  components: {},
  props: {
    pagination: {
      type: Object
    },
    numChange: {
      type: Function
    },
    reload: {
      type: Boolean,
      default: true
    }
  },
  data () {
    return {
    };
  },
  methods: {
    handleNumChange(num){
      if(this.numChange){
        this.numChange(num);
      }
    }
  },
  watch:{
    pagination: {
      handler(newV){
        this.pagination = Object.assign(newV);
      },
      deep: true
    }
  }
}
</script>